#include "main.h"

void socket_link(int *socketFD, char *ip, char *port){
    
    //创建socket套接字
    *socketFD = socket(AF_INET, SOCK_STREAM, 0);
    ERROR_CHECK(*socketFD, -1, "socket");

    //绑定ip和端口
    struct sockaddr_in Addr;
    Addr.sin_family = AF_INET;
    Addr.sin_port = htons(atoi(port));
    Addr.sin_addr.s_addr = inet_addr(ip);

    //创建连接
    int ret = connect(*socketFD, (struct sockaddr*)&Addr, sizeof(Addr));
    ERROR_CHECK(ret, -1, "connect");


}

